%% Author: lzz
%% Created: 2011.05.05
%% Description:TD
-module(data_td).

%%
%% Include files
%%


%%
%% Exported Functions
%%
-compile(export_all).

opt_mon_cost(Def, Map_type) ->
	case [Def, Map_type] of
		[{0, 1}, 998] -> 150;
		[{0, 2}, 998] -> 250;
		[{0, 3}, 998] -> 500;
		[{0, 4}, 998] -> 1000;
		[{0, 5}, 998] -> 2000;
		[{1, 1}, 998] -> 15; 
		[{1, 2}, 998] -> 75; 
		[{1, 3}, 998] -> 150;
		[{1, 4}, 998] -> 300;
		[{1, 5}, 998] -> 600;
		[{2, 1}, 998] -> 15;
		[{2, 2}, 998] -> 75;
		[{2, 3}, 998] -> 150;
		[{2, 4}, 998] -> 300;
		[{2, 5}, 998] -> 600;
		[{3, 1}, 998] -> 15;
		[{3, 2}, 998] -> 75;
		[{3, 3}, 998] -> 150;
		[{3, 4}, 998] -> 300;
		[{3, 5}, 998] -> 600;
		[{0, 1}, 999] -> 180;
		[{0, 2}, 999] -> 300;
		[{0, 3}, 999] -> 600;
		[{0, 4}, 999] -> 1200;
		[{0, 5}, 999] -> 2400;
		[{1, 1}, 999] -> 18; 
		[{1, 2}, 999] -> 90; 
		[{1, 3}, 999] -> 180;
		[{1, 4}, 999] -> 360;
		[{1, 5}, 999] -> 720;
		[{2, 1}, 999] -> 18;
		[{2, 2}, 999] -> 90;
		[{2, 3}, 999] -> 180;
		[{2, 4}, 999] -> 360;
		[{2, 5}, 999] -> 720;
		[{3, 1}, 999] -> 18;
		[{3, 2}, 999] -> 90;
		[{3, 3}, 999] -> 180;
		[{3, 4}, 999] -> 360;
		[{3, 5}, 999] -> 720;
		_ -> 999999
	end.

up_mon_cost(Def, Map_type) ->
	case [Def, Map_type] of
		[{0,1}, 998]->500;
		[{0,2}, 998]->1000;
		[{0,3}, 998]->2000;
		[{0,4}, 998]->4000;
		[{1,0}, 998]->75;  
		[{1,1}, 998]->150; 
		[{1,2}, 998]->300; 
		[{1,3}, 998]->600; 
		[{1,4}, 998]->1200;
		[{2,0}, 998]->75;
		[{2,1}, 998]->150;
		[{2,2}, 998]->300;
		[{2,3}, 998]->600;
		[{2,4}, 998]->1200;
		[{3,0}, 998]->75;
		[{3,1}, 998]->150;
		[{3,2}, 998]->300;
		[{3,3}, 998]->600;
		[{3,4}, 998]->1200;
		[{0,1}, 999]->600;
		[{0,2}, 999]->1200;
		[{0,3}, 999]->2400;
		[{0,4}, 999]->4800;
		[{1,0}, 999]->90;  
		[{1,1}, 999]->180; 
		[{1,2}, 999]->360; 
		[{1,3}, 999]->720; 
		[{1,4}, 999]->1440;
		[{2,0}, 999]->90;
		[{2,1}, 999]->180;
		[{2,2}, 999]->360;
		[{2,3}, 999]->720;
		[{2,4}, 999]->1440;
		[{3,0}, 999]->90;
		[{3,1}, 999]->180;
		[{3,2}, 999]->360;
		[{3,3}, 999]->720;
		[{3,4}, 999]->1440;
		_ -> 999999
	end.

get_sw_up_info(SwLv, Maptype) ->
	case [SwLv, Maptype] of
		[1, 998] -> [21613, 21613, <<"镇妖剑二级">>, 0];
		[2, 998] -> [30857, 30857, <<"镇妖剑三级">>, 0];
		[3, 998] -> [89322, 89322, <<"镇妖剑四级">>, 0];
		[4, 998] -> [98859, 98859, <<"镇妖剑五级">>, 0];
		[1, 999] -> [28513, 28513, <<"镇妖剑二级">>, 0];
		[2, 999] -> [65889, 65889, <<"镇妖剑三级">>, 0];
		[3, 999] -> [74109, 74109, <<"镇妖剑四级">>, 0];
		[4, 999] -> [119502, 119502, <<"镇妖剑五级">>, 0];
		_ -> [0, 0, <<"错误">>, 0]
	end.

get_mon_list(Att_num, Map_type)->
	case [Att_num, Map_type] of
		[1,998]->[{46001,5}];
		[2,998]->[{46002,5}];
		[3,998]->[{46003,5}];
		[4,998]->[{46004,5}];
		[5,998]->[{46141,2},{46005,3}];
		[6,998]->[{46006,5}];
		[7,998]->[{46007,5}];
		[8,998]->[{46008,5}];
		[9,998]->[{46009,5}];
		[10,998]->[{46010,1}];
		[11,998]->[{46011,5}];
		[12,998]->[{46012,5}];
		[13,998]->[{46013,5}];
		[14,998]->[{46014,5}];
		[15,998]->[{46142,2},{46015,3}];
		[16,998]->[{46016,5}];
		[17,998]->[{46017,5}];
		[18,998]->[{46018,5}];
		[19,998]->[{46019,5}];
		[20,998]->[{46020,1}];
		[21,998]->[{46021,5}];
		[22,998]->[{46022,5}];
		[23,998]->[{46023,5}];
		[24,998]->[{46024,5}];
		[25,998]->[{46143,2},{46025,3}];
		[26,998]->[{46026,5}];
		[27,998]->[{46027,5}];
		[28,998]->[{46028,5}];
		[29,998]->[{46029,5}];
		[30,998]->[{46030,1}];
		[31,998]->[{46031,5}];
		[32,998]->[{46032,5}];
		[33,998]->[{46033,5}];
		[34,998]->[{46034,5}];
		[35,998]->[{46144,2},{46035,3}];
		[36,998]->[{46036,5}];
		[37,998]->[{46037,5}];
		[38,998]->[{46038,5}];
		[39,998]->[{46039,5}];
		[40,998]->[{46040,1}];
		[41,998]->[{46041,5}];
		[42,998]->[{46042,5}];
		[43,998]->[{46043,5}];
		[44,998]->[{46044,5}];
		[45,998]->[{46145,2},{46045,3}];
		[46,998]->[{46046,5}];
		[47,998]->[{46047,5}];
		[48,998]->[{46048,5}];
		[49,998]->[{46049,5}];
		[50,998]->[{46050,1}];
		[51,998]->[{46051,5}];
		[52,998]->[{46052,5}];
		[53,998]->[{46053,5}];
		[54,998]->[{46054,5}];
		[55,998]->[{46146,2},{46055,3}];
		[56,998]->[{46056,5}];
		[57,998]->[{46057,5}];
		[58,998]->[{46058,5}];
		[59,998]->[{46059,5}];
		[60,998]->[{46060,1}];
		[61,998]->[{46061,5}];
		[62,998]->[{46062,5}];
		[63,998]->[{46063,5}];
		[64,998]->[{46064,5}];
		[65,998]->[{46147,2},{46065,3}];
		[66,998]->[{46066,5}];
		[67,998]->[{46067,5}];
		[68,998]->[{46068,5}];
		[69,998]->[{46069,5}];
		[70,998]->[{46070,1}];
		[71,998]->[{46155,5}];
		[72,998]->[{46156,5}];
		[73,998]->[{46157,5}];
		[74,998]->[{46158,5}];
		[75,998]->[{46177,2},{46159,3}];
		[76,998]->[{46160,5}];
		[77,998]->[{46161,5}];
		[78,998]->[{46162,5}];
		[79,998]->[{46163,5}];
		[80,998]->[{46164,1}];
		[1,999]->[{46071,5}];
		[2,999]->[{46072,5}];
		[3,999]->[{46073,5}];
		[4,999]->[{46074,5}];
		[5,999]->[{46148,2},{46075,3}];
		[6,999]->[{46076,5}];
		[7,999]->[{46077,5}];
		[8,999]->[{46078,5}];
		[9,999]->[{46079,5}];
		[10,999]->[{46080,1}];
		[11,999]->[{46081,5}];
		[12,999]->[{46082,5}];
		[13,999]->[{46083,5}];
		[14,999]->[{46084,5}];
		[15,999]->[{46149,2},{46085,3}];
		[16,999]->[{46086,5}];
		[17,999]->[{46087,5}];
		[18,999]->[{46088,5}];
		[19,999]->[{46089,5}];
		[20,999]->[{46090,1}];
		[21,999]->[{46091,5}];
		[22,999]->[{46092,5}];
		[23,999]->[{46093,5}];
		[24,999]->[{46094,5}];
		[25,999]->[{46150,2},{46095,3}];
		[26,999]->[{46096,5}];
		[27,999]->[{46097,5}];
		[28,999]->[{46098,5}];
		[29,999]->[{46099,5}];
		[30,999]->[{46100,1}];
		[31,999]->[{46101,5}];
		[32,999]->[{46102,5}];
		[33,999]->[{46103,5}];
		[34,999]->[{46104,5}];
		[35,999]->[{46151,2},{46105,3}];
		[36,999]->[{46106,5}];
		[37,999]->[{46107,5}];
		[38,999]->[{46108,5}];
		[39,999]->[{46109,5}];
		[40,999]->[{46110,1}];
		[41,999]->[{46111,5}];
		[42,999]->[{46112,5}];
		[43,999]->[{46113,5}];
		[44,999]->[{46114,5}];
		[45,999]->[{46152,2},{46115,3}];
		[46,999]->[{46116,5}];
		[47,999]->[{46117,5}];
		[48,999]->[{46118,5}];
		[49,999]->[{46119,5}];
		[50,999]->[{46120,1}];
		[51,999]->[{46121,5}];
		[52,999]->[{46122,5}];
		[53,999]->[{46123,5}];
		[54,999]->[{46124,5}];
		[55,999]->[{46153,2},{46125,3}];
		[56,999]->[{46126,5}];
		[57,999]->[{46127,5}];
		[58,999]->[{46128,5}];
		[59,999]->[{46129,5}];
		[60,999]->[{46130,1}];
		[61,999]->[{46131,5}];
		[62,999]->[{46132,5}];
		[63,999]->[{46133,5}];
		[64,999]->[{46134,5}];
		[65,999]->[{46154,2},{46135,3}];
		[66,999]->[{46136,5}];
		[67,999]->[{46137,5}];
		[68,999]->[{46138,5}];
		[69,999]->[{46139,5}];
		[70,999]->[{46140,1}];
		_ -> error
	end.

get_def_mid(Def, Map_type) ->
	case [Def, Map_type] of
		[{1, 1}, 998] -> 46912;
		[{1, 2}, 998] -> 46913;
		[{1, 3}, 998] -> 46914;
		[{1, 4}, 998] -> 46915;
		[{1, 5}, 998] -> 46916;
		[{2, 1}, 998] -> 46907;
		[{2, 2}, 998] -> 46908;
		[{2, 3}, 998] -> 46909;
		[{2, 4}, 998] -> 46910;
		[{2, 5}, 998] -> 46911;
		[{3, 1}, 998] -> 46902;
		[{3, 2}, 998] -> 46903;
		[{3, 3}, 998] -> 46904;
		[{3, 4}, 998] -> 46905;
		[{3, 5}, 998] -> 46906;
		[{1, 1}, 999] -> 46928;
		[{1, 2}, 999] -> 46929;
		[{1, 3}, 999] -> 46930;
		[{1, 4}, 999] -> 46931;
		[{1, 5}, 999] -> 46932;
		[{2, 1}, 999] -> 46923;
		[{2, 2}, 999] -> 46924;
		[{2, 3}, 999] -> 46925;
		[{2, 4}, 999] -> 46926;
		[{2, 5}, 999] -> 46927;
		[{3, 1}, 999] -> 46918;
		[{3, 2}, 999] -> 46919;
		[{3, 3}, 999] -> 46920;
		[{3, 4}, 999] -> 46921;
		[{3, 5}, 999] -> 46922;
		_ -> 999999
	end.

get_mon_info(MonID) ->
	case MonID of
		46001->[1,6,0,1,5];
		46002->[2,8,0,2,5];
		46003->[3,10,0,3,5];
		46004->[4,12,0,4,5];
		46141->[1,1,0,5,2];
		46005->[20,22,1,5,3];
		46006->[6,12,0,6,5];
		46007->[7,13,0,7,5];
		46008->[8,14,0,8,5];
		46009->[9,15,0,9,5];
		46010->[90,77,1,10,1];
		46011->[11,16,0,11,5];
		46012->[12,17,0,12,5];
		46013->[13,18,0,13,5];
		46014->[14,19,0,14,5];
		46142->[2,2,0,15,2];
		46015->[70,33,1,15,3];
		46016->[16,21,0,16,5];
		46017->[17,21,0,17,5];
		46018->[18,22,0,18,5];
		46019->[19,23,0,19,5];
		46020->[190,119,1,20,1];
		46021->[21,24,0,21,5];
		46022->[22,26,0,22,5];
		46023->[23,28,0,23,5];
		46024->[24,29,0,24,5];
		46143->[3,3,0,25,2];
		46025->[120,51,1,25,3];
		46026->[26,32,0,26,5];
		46027->[27,34,0,27,5];
		46028->[28,36,0,28,5];
		46029->[29,38,0,29,5];
		46030->[290,198,1,30,1];
		46031->[31,41,0,31,5];
		46032->[32,43,0,32,5];
		46033->[33,44,0,33,5];
		46034->[34,46,0,34,5];
		46144->[4,4,0,35,2];
		46035->[170,80,1,35,3];
		46036->[36,49,0,36,5];
		46037->[37,52,0,37,5];
		46038->[38,55,0,38,5];
		46039->[39,58,0,39,5];
		46040->[390,308,1,40,1];
		46041->[41,65,0,41,5];
		46042->[42,68,0,42,5];
		46043->[43,72,0,43,5];
		46044->[44,76,0,44,5];
		46145->[5,5,0,45,2];
		46045->[220,132,1,45,3];
		46046->[46,82,0,46,5];
		46047->[47,86,0,47,5];
		46048->[48,89,0,48,5];
		46049->[49,92,0,49,5];
		46050->[490,477,1,50,1];
		46051->[51,97,0,51,5];
		46052->[52,104,0,52,5];
		46053->[53,110,0,53,5];
		46054->[54,117,0,54,5];
		46146->[6,6,0,55,2];
		46055->[270,205,1,55,3];
		46056->[56,130,0,56,5];
		46057->[57,136,0,57,5];
		46058->[58,144,0,58,5];
		46059->[59,152,0,59,5];
		46060->[590,792,1,60,1];
		46061->[61,165,0,61,5];
		46062->[62,171,0,62,5];
		46063->[63,178,0,63,5];
		46064->[64,184,0,64,5];
		46147->[7,7,0,65,2];
		46065->[320,318,1,65,3];
		46066->[66,103,0,66,5];
		46067->[67,104,0,67,5];
		46068->[68,105,0,68,5];
		46069->[69,106,0,69,5];
		46070->[690,800,1,70,1];
		46155->[61,88,0,71,5];
		46156->[62,88,0,72,5];
		46157->[63,88,0,73,5];
		46158->[64,88,0,74,5];
		46177->[7,10,0,75,2];
		46159->[320,100,1,75,3];
		46160->[66,88,0,76,5];
		46161->[67,88,0,77,5];
		46162->[68,88,0,78,5];
		46163->[69,88,0,79,5];
		46164->[690,2000,1,80,1];
		46071->[1,6,0,1,5];
		46072->[2,8,0,2,5];
		46073->[3,10,0,3,5];
		46074->[4,12,0,4,5];
		46148->[1,1,0,5,2];
		46075->[20,22,1,5,3];
		46076->[6,12,0,6,5];
		46077->[7,13,0,7,5];
		46078->[8,14,0,8,5];
		46079->[9,15,0,9,5];
		46080->[90,77,1,10,1];
		46081->[11,16,0,11,5];
		46082->[12,17,0,12,5];
		46083->[13,18,0,13,5];
		46084->[14,19,0,14,5];
		46149->[2,2,0,15,2];
		46085->[70,33,1,15,3];
		46086->[16,21,0,16,5];
		46087->[17,21,0,17,5];
		46088->[18,22,0,18,5];
		46089->[19,23,0,19,5];
		46090->[190,119,1,20,1];
		46091->[21,24,0,21,5];
		46092->[22,26,0,22,5];
		46093->[23,28,0,23,5];
		46094->[24,29,0,24,5];
		46150->[3,3,0,25,2];
		46095->[120,51,1,25,3];
		46096->[26,32,0,26,5];
		46097->[27,34,0,27,5];
		46098->[28,36,0,28,5];
		46099->[29,38,0,29,5];
		46100->[290,198,1,30,1];
		46101->[31,41,0,31,5];
		46102->[32,43,0,32,5];
		46103->[33,44,0,33,5];
		46104->[34,46,0,34,5];
		46151->[4,4,0,35,2];
		46105->[170,80,1,35,3];
		46106->[36,49,0,36,5];
		46107->[37,52,0,37,5];
		46108->[38,55,0,38,5];
		46109->[39,58,0,39,5];
		46110->[390,308,1,40,1];
		46111->[41,65,0,41,5];
		46112->[42,68,0,42,5];
		46113->[43,72,0,43,5];
		46114->[44,76,0,44,5];
		46152->[5,5,0,45,2];
		46115->[220,132,1,45,3];
		46116->[46,82,0,46,5];
		46117->[47,86,0,47,5];
		46118->[48,89,0,48,5];
		46119->[49,92,0,49,5];
		46120->[490,477,1,50,1];
		46121->[51,97,0,51,5];
		46122->[52,104,0,52,5];
		46123->[53,110,0,53,5];
		46124->[54,117,0,54,5];
		46153->[6,6,0,55,2];
		46125->[270,205,1,55,3];
		46126->[56,130,0,56,5];
		46127->[57,136,0,57,5];
		46128->[58,144,0,58,5];
		46129->[59,152,0,59,5];
		46130->[590,792,1,60,1];
		46131->[61,165,0,61,5];
		46132->[62,171,0,62,5];
		46133->[63,178,0,63,5];
		46134->[64,184,0,64,5];
		46154->[7,7,0,65,2];
		46135->[320,318,1,65,3];
		46136->[66,103,0,66,5];
		46137->[67,104,0,67,5];
		46138->[68,105,0,68,5];
		46139->[69,106,0,69,5];
		46140->[690,800,1,70,1];
	_ ->error
end.

%%获取跳波后的基础经验灵力
get_skip_exp_spi(SkipAtt) ->
	case SkipAtt of
		19 -> [273591,136813];
		29 -> [424393,212222];
		39 -> [579726,289899];
		_ -> [0,0]
	end.

%%一波怪物共有的荣誉和魔力总值
get_mon_p([],Hor_t,Mgc_t)->
	[Hor_t,Mgc_t];
get_mon_p([{Mid,Num}|T],Hor_t,Mgc_t) ->
	[Hor_p, Mgc_p, _Is_boss, _Att_num, _Mon_num] = data_td:get_mon_info(Mid),
	Hor_pt = Hor_p * Num,
	Mgc_pt = Mgc_p * Num,
	get_mon_p(T,Hor_t+Hor_pt,Mgc_t+Mgc_pt).

%% N波怪物共有的荣誉和魔力总值	
get_skip_hor_mgc(SkipAtt ,SceneId)->
	F = fun(Attnum) ->
				data_td:get_mon_list(Attnum,SceneId)
		end,
	TotalMonList = lists:map(F, lists:seq(1, SkipAtt)),
	F_sum = fun(MonList,[Hor_t,Mgc_t]) ->				
				[Hor_p,Mgc_p] = get_mon_p(MonList,0,0),
				[Hor_t+Hor_p,Mgc_t+Mgc_p]
			end,
	[Total_Hor,Total_Mgc] = lists:foldl(F_sum, [0,0], TotalMonList),
	[Total_Hor,Total_Mgc].

			